// tabBarComponent/tabBar.js
const app = getApp();
Component({
  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    "backgroundColor": "#ffffff",
    "color": "#979795",
    "selectedColor": "#1c1c1b",
    "list": [
              {
                "pagePath": "/pages/index/index",
                "iconPath": "/images/home.png",
                "selectedIconPath": "/images/homea.png",
                "text": "首页"
              },
              {
                "pagePath": "/pages/classify/classify",
                "iconPath": "/images/funtion.png",
                "selectedIconPath": "/images/funtiona.png",
                "text": "分类"
              },
              {
                "pagePath": "/pages/car/car",
                "iconPath": "/images/collection.png",
                "selectedIconPath": "/images/collectiona.png",
                "text": "购物车"
              },
              {
                "pagePath": "/pages/mine/mine",
                "iconPath": "/images/mine.png",
                "selectedIconPath": "/images/minea.png",
                "text": "我的"
              }
            ]
  },
   attached() {
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      console.log(e);
      const idx = e.currentTarget.dataset.index
      const path = e.currentTarget.dataset.path
      wx.switchTab({
        url: path,
      });
    }
  }
})
